<!--鉴定专家抽取-->
<template>
    <el-main>
    <el-main class="ep-body">
        <epl-top-bar :datas="{formData:form,panel:panel}" showPerson personType="PERSON_ALL_EXACT" psTagType="PERSON_INJURY_QUERY">
            <ep-button size="small" name="刷新"></ep-button>
        </epl-top-bar>
        <epl-userMessage dataType="person" idCount="4" >
        </epl-userMessage>
        <el-card class="ep-card">
            <el-form :model="form" :rules="rules" >
                <el-row :gutter="10">
                    <ep-select  colspan="8" label="鉴定场次" name="baz501" :property="form.baz501"
                                codetype="BAZ501"    p="E"   :datas="{formData: form}" ></ep-select>
                    <ep-select  colspan="8" label="区域" name="baz502" :property="form.baz502"
                                codetype="BAZ502"    p="E"   :datas="{formData: form}" ></ep-select>
                    <ep-checkbox  colspan="8" label="新老专家" name="bac501" :property="form.bac501"
                                  codetype="BAC501"     p="E"   :datas="{formData: form}" ></ep-checkbox>
                </el-row>
                <el-row :gutter="10">
                    <ep-select  colspan="8" label="鉴定科别" name="blc504" :property="form.blc504"
                                codetype="BLC504"  p="E"   :datas="{formData: form}" ></ep-select>
                    <ep-input  colspan="8" label="预抽人数" name="bae519" :property="form.bae519"
                               p="E"   :datas="{formData: form}" ></ep-input>
                </el-row>
            </el-form>
        </el-card>

        <el-card class="ep-card" >
            <el-row>
                <el-transfer
                    style="text-align: left; display: inline-block "
                    v-model="tableselect"
                    filterable
                    :titles="['专家库列表', '已选列表']"
                    :button-texts="['到左边', '到右边']"
                    :render-content="renderFunc"
                    @change="handleChange"
                    :data="tableData">

                    <el-button class="transfer-footer" slot="left-footer" size="small">操作</el-button>
                </el-transfer>
            </el-row>
        </el-card>
        <el-row type="flex" justify="center" >
            <ep-saveButton id="" top="20" type="primary" bottom="20"
                           :datas="{formData: form}" name="保存"></ep-saveButton>
            <ep-Button id="" top="20" type="primary" bottom="20"
                       name="清空"></ep-Button>
        </el-row>
    </el-main>
    </el-main>
</template>
<script type="es6">
    export default {
        data() {
            return {
                form:{
                    baz501: {
                        key: '',
                        value: '',
                        p: 'E'
                    },
                    baz502: {
                        key: '',
                        value: '',
                        p: 'E'
                    },
                    bac501: {
                        key: [],
                        value: []
                    },
                    blc504: {
                        key: '',
                        value: '',
                        p: 'E'
                    },
                    bae519: {
                        value: '',
                        p: 'E'
                    },

                },
                tableselect: '',

                rules:{

                },
                codeTypes:{
                    BAZ501:[],
                    BAZ502:[],
                    BAC501:[],
                    BLC504:[],

                },
                pager: {
                    page: 1,
                    size: 10
                },
                total: 0,
            }
        },
        computed: {
            backFun() {
                return this.$store.getters.backFun;
            },
            init_formData() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.form;
            },
            doInitformData: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.formData;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },
            init_tableDataKey() {
                return this.$store.getters.init.tableDataValue;
            },
            doInittableDataKey: {
                get: function () {
                    if (this.$store.getters.init === null) return [];
                    if (this.$store.getters.init.path !== this.$route.path) return;
                    return this.$store.getters.init.tableDataKey;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },

        },
        created() {
            let param = {
                path: this.$route.path,
                codeTypes:this.codeTypes,
                form:this.form,
                tableData:this.tableData

            };
            this.$store.dispatch('SET_INIT', param);
        },
        watch: {
            doInittableData: {
                handler(value) {
                    if (value == undefined) return;
                    this.gettableData(value);
                },
                deep: true
            },
            init_formData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            doInitformData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },

            backFun: {
                handler(value) {
                    if (value === null) return;
                    this.customBackFun();
                    let backFun = [];
                    backFun = value.split(',');
                    if (backFun.indexOf('rDoInit') >= 0) {
                        let codeTypes = {
                            BAZ501:[],
                            BAZ502:[],
                            BAC501:[],
                            BLC504:[],

                        };
                        let form = {
                            baz501: {
                                key: '',
                                value: '',
                                p: 'E'
                            },
                            baz502: {
                                key: '',
                                value: '',
                                p: 'E'
                            },
                            bac501: {
                                key: [],
                                value: []
                            },
                            blc504: {
                                key: '',
                                value: '',
                                p: 'E'
                            },
                            bae519: {
                                value: '',
                                p: 'E'
                            },

                        };

                        let param = {
                            path: this.$route.path,
                            codeTypes:codeTypes,
                            form:form,
                            tableData:tableData

                        };
                        this.$store.dispatch('SET_INIT', param);
                    }
                }
            }
        },
        methods: {
            getformData(value) {
                this.form = value;
            },
            gettableDataKey(value) {
                this.tableDataValue = value;
            },

            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            handleEdit(id) {
                this.dialogFormVisible = true;
            },
            customBackFun(){//自定义方法体
            },
        },
    }
</script>
